When creating an application program for a computer such as a PC, the design of the user interface is a major concern to the application developer. In developing the user interface, the programmer typically has to include code to capture input from the user and provide output using the computer's peripherals. The interaction between an application and peripheral devices can vary significantly depending on the type of application and sophistication of the user interface. In a spreadsheet program, for example, the application needs to be informed when the user has updated a cell in a spreadsheet so that it can update the spreadsheet and display the proper result. Since the display changes rather infrequently and does not contain complex graphics in this example, the performance of the underlying software and hardware that controls the user interface is less critical. As such, the programmer can rely on a high level interface to graphics and input devices without being particularly concerned with the performance of the interface.
The user interfaces of many of today's multimedia applications, however, are significantly more complex and have rigorous performance requirements. In multimedia games for example, the interaction between the application and peripherals is critical to achieving a highly interactive and realistic user interface. The interaction between the application can include not only reading input from a joystick and displaying images, but can also include mixing audio files to generate sound effects, rendering three dimensional animation using a graphics accelerator, decompressing and playing video, and updating the display image fast enough to depict realistic scenes.
To control a peripheral devices in this manner, the application program can attempt to control the peripheral devices directly or can perform operations through a software interface. A software interface provides access to certain services through a specified set of operations which can be invoked to request the services. For instance, an interface to sound effect services might include operations to "prepare a sound for playing," "start playing a sound," and "wait until a sound has finished playing." In response to a request for a particular service, the interface attempts to provide the service by taking steps to control the underlying hardware. In effect, the interface does what the application would have to do if it were to try to control the hardware directly. In addition to communicating with the hardware, an interface sometimes provides some resource management so that programs running in the computer can share access to the limited hardware resources.
For the vast majority of applications, application programmers rely on some form of software interface to interact with the computer's peripherals. Programmers typically rely on software interfaces to the peripherals so that they can focus on the specifics of their application rather than on the specifics of controlling a particular device. Unfortunately, many of today's software interfaces cannot provide the level of performance that multimedia applications demand.
There are a number of software products on the market today that provide interfaces between application programs and peripheral devices. These interfaces are sometimes characterized as low or high level interfaces, and device independent or dependent. A high level interface is one whose operations request big-picture strategic services, such as "start playing this sound" or "display this document." A low level interface is one whose operations request tactical services specifically, such as "tell the sound card at I/O (input/output) address 220 to point its DMA buffer to memory address 1000000" or "tell the video card to copy the 64.times.64 pixel region from a location starting at address 0000001 to a location starting at 1000000 in video memory. In general a high level interface may be easier for a programmer to use, but a low level interface may provide better performance and functionality. Ease of use comes from having fewer details to take care of, while better performance comes from taking advantage of special cases the hardware handles well. Hiding details tends to disguise special cases as well.
The terms "device independent" and "device dependent" refer to the extent to which the interface is specific to a particular piece of hardware. Device independent interfaces provide operations that are not specific to a particular brand of hardware device. Instead, the operations hide the detail of the hardware from the application and take care of these details internally. In contrast, device dependent interfaces provide operations to control specific features of a particular piece of hardware. To write an application using a device dependent interface, the application developer has to have a detailed understanding of how the specific hardware operates.
Hardware dependence is usually not favored because it is not flexible to changes in the underlying hardware and can often lead to resource contention problems. Programs written for a device dependent interface can be rendered obsolete by updates to the underlying hardware, and commonly do not work for more than one brand of peripheral. In addition, device dependent interfaces are more susceptible to resource management problems because an application has access to its state information and can render it inoperable for other applications.
In general, high level interfaces tend to be device independent because they hide details, whereas low level interfaces tend to be device dependent because they reveal details. For instance, "play a sound" does not rely on the details of any sound card, but "tell the sound card at I/O address 220 . . . " obviously does.
While device independent, high level interfaces are generally easier to use for the reasons explained above, they typically are unable to provide the performance and functionality needed for certain types of applications. High level interfaces are often not sufficient for game applications and other multimedia applications because they are often incapable of achieving the desired performance. Games demand higher performance because they must achieve a high degree of user interactivity and visual realism. A game application typically has to collect rapidly changing user input, compute its impact on the current scene, and display the corresponding images and playback sounds with imperceptible delay.
Because they are designed for specific tasks, peripherals are usually much better at performing certain types of functions than the host processor. For example, a video card may have special purpose hardware that can copy pixels much faster than the CPU. A high level interface may not take advantage of this particular feature or may include additional layers of code that consume valuable CPU cycles and time before the operation is even started on the peripheral.
Since many peripherals have their own computing resources, such as processors and memory, performance can be improved by off-loading some tasks to the peripheral rather than consuming the resources of the host CPU. However, without a low level interface to expose these resources to the application, they are not fully exploited.
Resource management is an important aspect of software interfaces for multimedia devices. In this context, resource management refers to how the system software or software interfaces in the computer control allocation of the multimedia hardware among applications that wish to use those resources. For example, resource management enables applications to share access to a display device or a sound device for example. In a multitasking environment, a number of applications may wish to control a portion of the display or control the audio output, for example.
One way to allocate resources is simply to give the resources on a first come, first serve or "cooperative" basis. This is not an adequate solution for applications which require more extensive use of a particular resource. For example, a game application may need to have complete control of both the display device and sound card in the computer to operate effectively.
One solution often used to support these types of applications is to give them complete control over the entire system. In this circumstance, there is no multitasking capability at all. Obviously, this is not an acceptable alternative because the user can not easily change focus from one application to the next.